<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>登录</title>
<link rel="stylesheet" href="static/css/index.css" />
    <script src="static/js/jquery-3.3.1.min.js" ></script>
    <script src="static/admin/js/script.js" ></script>
</head>
<body>
<div class="top">正真科技&nbsp;·&nbsp;用数据改变未来</div>
<div class="content">
<div class="login">
<div class="title">正真科技&nbsp;·&nbsp;登录</div>
<div class="line">
    <img class="smallImg" src="static/img/icon-4.png" />
<input placeholder="请输入账号" id="username" type="text" />
</div>
<div class="line">
<img class="smallImg" src="static/img/icon-5.png" />
<input placeholder="请输入密码"  id ="psw" type="password" />
</div>
<button type="button" onclick="check_login()" class="logBut">登&nbsp;&nbsp;录</button>
</div>
</div>
</body>
<script>
    function check_login() {
        var name=$("#username").val();
        var pass=$("#psw").val();
        if(name=="" || pass=="") {
            alert("用户名和密码不能为空");
        } else {
            $.ajax({
                type: "POST",
                url: baseUrl+"/zhangcong!login",
                data: {"zhangCongEntity.name":name,"zhangCongEntity.password":pass},
                success: function (res) {

                    if(res == '1'){
                        //重新查询
                        window.location.href= "user_index.html";
                    }else{
                        $("#psw").val("");
                        alert("登录失败,用户名和密码不正确！");
                    }
                },
                error: function(data) {
                    alert("系统出现异常")
                }

            });


        }
    }
</script>
</html>